home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / outline.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  15.5 KB  |  388 lines

  1. // Borland C++ Builder
  2. // Copyright (c) 1995, 1998 by Borland International
  3. // All rights reserved
  4.  
  5. // (DO NOT EDIT: machine generated header) 'Outline.pas' rev: 3.00
  6.  
  7. #ifndef OutlineHPP
  8. #define OutlineHPP
  9. #include <SysUtils.hpp>
  10. #include <Controls.hpp>
  11. #include <Grids.hpp>
  12. #include <StdCtrls.hpp>
  13. #include <Menus.hpp>
  14. #include <Graphics.hpp>
  15. #include <Classes.hpp>
  16. #include <Forms.hpp>
  17. #include <Messages.hpp>
  18. #include <Windows.hpp>
  19. #include <SysInit.hpp>
  20. #include <System.hpp>
  21.  
  22. //-- user supplied -----------------------------------------------------------
  23.  
  24. namespace Outline
  25. {
  26. //-- type declarations -------------------------------------------------------
  27. class DELPHICLASS OutlineError;
  28. class PASCALIMPLEMENTATION OutlineError : public System::TObject 
  29. {
  30.     typedef System::TObject inherited;
  31.     
  32. public:
  33.     /* TObject.Create */ __fastcall OutlineError(void) : System::TObject() { }
  34.     /* TObject.Destroy */ __fastcall virtual ~OutlineError(void) { }
  35.     
  36. };
  37.  
  38. class DELPHICLASS EOutlineError;
  39. class PASCALIMPLEMENTATION EOutlineError : public Sysutils::Exception 
  40. {
  41.     typedef Sysutils::Exception inherited;
  42.     
  43. public:
  44.     /* Exception.Create */ __fastcall EOutlineError(const System::AnsiString Msg) : Sysutils::Exception(
  45.         Msg) { }
  46.     /* Exception.CreateFmt */ __fastcall EOutlineError(const System::AnsiString Msg, const System::TVarRec 
  47.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  48.     /* Exception.CreateRes */ __fastcall EOutlineError(int Ident, Extended Dummy) : Sysutils::Exception(
  49.         Ident, Dummy) { }
  50.     /* Exception.CreateResFmt */ __fastcall EOutlineError(int Ident, const System::TVarRec * Args, const 
  51.         int Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  52.     /* Exception.CreateHelp */ __fastcall EOutlineError(const System::AnsiString Msg, int AHelpContext)
  53.          : Sysutils::Exception(Msg, AHelpContext) { }
  54.     /* Exception.CreateFmtHelp */ __fastcall EOutlineError(const System::AnsiString Msg, const System::TVarRec 
  55.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  56.         ) { }
  57.     /* Exception.CreateResHelp */ __fastcall EOutlineError(int Ident, int AHelpContext) : Sysutils::Exception(
  58.         Ident, AHelpContext) { }
  59.     /* Exception.CreateResFmtHelp */ __fastcall EOutlineError(int Ident, const System::TVarRec * Args, 
  60.         const int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext)
  61.          { }
  62.     
  63. public:
  64.     /* TObject.Destroy */ __fastcall virtual ~EOutlineError(void) { }
  65.     
  66. };
  67.  
  68. enum TOutlineNodeCompare { ocLess, ocSame, ocGreater, ocInvalid };
  69.  
  70. enum TAttachMode { oaAdd, oaAddChild, oaInsert };
  71.  
  72. typedef Shortint TChangeRange;
  73.  
  74. class DELPHICLASS TOutlineNode;
  75. class DELPHICLASS TCustomOutline;
  76. enum TOutlineBitmap { obPlus, obMinus, obOpen, obClose, obLeaf };
  77.  
  78. typedef Set<TOutlineBitmap, obPlus, obLeaf>  TOutlineBitmaps;
  79.  
  80. typedef Graphics::TBitmap* TBitmapArray[5];
  81.  
  82. typedef void __fastcall (__closure *EOutlineChange)(System::TObject* Sender, int Index);
  83.  
  84. enum TOutlineStyle { osText, osPlusMinusText, osPictureText, osPlusMinusPictureText, osTreeText, osTreePictureText 
  85.     };
  86.  
  87. enum TOutlineType { otStandard, otOwnerDraw };
  88.  
  89. enum TOutlineOption { ooDrawTreeRoot, ooDrawFocusRect, ooStretchBitmaps };
  90.  
  91. typedef Set<TOutlineOption, ooDrawTreeRoot, ooStretchBitmaps>  TOutlineOptions;
  92.  
  93. class PASCALIMPLEMENTATION TCustomOutline : public Grids::TCustomGrid 
  94. {
  95.     typedef Grids::TCustomGrid inherited;
  96.     
  97. private:
  98.     bool FBlockInsert;
  99.     TOutlineNode* FRootNode;
  100.     TOutlineNode* FGoodNode;
  101.     int UpdateCount;
  102.     TOutlineNode* FCurItem;
  103.     System::AnsiString FSeparator;
  104.     int FFontSize;
  105.     Classes::TStrings* FStrings;
  106.     TOutlineBitmaps FUserBitmaps;
  107.     TOutlineBitmaps FOldBitmaps;
  108.     Graphics::TBitmap* FPictures[5];
  109.     EOutlineChange FOnExpand;
  110.     EOutlineChange FOnCollapse;
  111.     TOutlineStyle FOutlineStyle;
  112.     int FItemHeight;
  113.     TOutlineType FStyle;
  114.     TOutlineOptions FOptions;
  115.     bool FIgnoreScrollResize;
  116.     TOutlineNode* FSelectedItem;
  117.     Stdctrls::TDrawItemEvent FOnDrawItem;
  118.     bool FSettingWidth;
  119.     bool FSettingHeight;
  120.     HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message);
  121.     int __fastcall GetItemCount(void);
  122.     int __fastcall AttachNode(int Index, System::AnsiString Str, void * Ptr, TAttachMode AttachMode);
  123.     TOutlineNode* __fastcall Get(int Index);
  124.     int __fastcall GetSelectedItem(void);
  125.     void __fastcall SetSelectedItem(int Value);
  126.     TOutlineNodeCompare __fastcall CompareNodes(TOutlineNode* Value1, TOutlineNode* Value2);
  127.     void __fastcall Error(const System::AnsiString ErrorString);
  128.     HIDESBASE MESSAGE void __fastcall CMFontChanged(Messages::TMessage &Message);
  129.     bool __fastcall ResizeGrid(void);
  130.     void __fastcall DoExpand(TOutlineNode* Node);
  131.     void __fastcall Init(void);
  132.     void __fastcall MoveNode(int Destination, int Source, TAttachMode AttachMode);
  133.     void __fastcall ClearBitmap(Graphics::TBitmap* &Bitmap, TOutlineBitmap Kind);
  134.     void __fastcall ChangeBitmap(Graphics::TBitmap* Value, TOutlineBitmap Kind);
  135.     void __fastcall SetRowHeight(void);
  136.     void __fastcall SetCurItem(int Value);
  137.     void __fastcall CreateGlyph(void);
  138.     void __fastcall SetStrings(Classes::TStrings* Value);
  139.     Classes::TStrings* __fastcall GetStrings(void);
  140.     bool __fastcall IsCurItem(int Value);
  141.     void __fastcall SetPicture(int Index, Graphics::TBitmap* Value);
  142.     Graphics::TBitmap* __fastcall GetPicture(int Index);
  143.     void __fastcall DrawPictures(Graphics::TBitmap* const * BitMaps, const int BitMaps_Size, const Windows::TRect 
  144.         &ARect);
  145.     void __fastcall DrawText(TOutlineNode* Node, const Windows::TRect &Rect);
  146.     void __fastcall SetOutlineStyle(TOutlineStyle Value);
  147.     void __fastcall DrawTree(const Windows::TRect &ARect, TOutlineNode* Node);
  148.     void __fastcall SetItemHeight(int Value);
  149.     void __fastcall SetStyle(TOutlineType Value);
  150.     void __fastcall SetOutlineOptions(TOutlineOptions Value);
  151.     bool __fastcall StoreBitmap(int Index);
  152.     void __fastcall ReadBinaryData(Classes::TStream* Stream);
  153.     void __fastcall WriteBinaryData(Classes::TStream* Stream);
  154.     void __fastcall SetHorzScrollBar(void);
  155.     void __fastcall ResetSelectedItem(void);
  156.     void __fastcall SetRowFromNode(TOutlineNode* Node);
  157.     
  158. protected:
  159.     virtual void __fastcall Loaded(void);
  160.     DYNAMIC void __fastcall Click(void);
  161.     DYNAMIC void __fastcall KeyDown(Word &Key, Classes::TShiftState Shift);
  162.     DYNAMIC void __fastcall KeyPress(char &Key);
  163.     TOutlineNode* __fastcall SetGoodIndex(TOutlineNode* Value);
  164.     virtual void __fastcall DrawCell(int ACol, int ARow, const Windows::TRect &ARect, Grids::TGridDrawState 
  165.         AState);
  166.     DYNAMIC void __fastcall DblClick(void);
  167.     void __fastcall SetLevel(TOutlineNode* Node, Cardinal CurLevel, Cardinal NewLevel);
  168.     bool __fastcall BadIndex(TOutlineNode* Value);
  169.     void __fastcall DeleteNode(TOutlineNode* Node, int CurIndex);
  170.     DYNAMIC void __fastcall Expand(int Index);
  171.     DYNAMIC void __fastcall Collapse(int Index);
  172.     virtual void __fastcall DefineProperties(Classes::TFiler* Filer);
  173.     DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, 
  174.         int Y);
  175.     void __fastcall Move(int Destination, int Source, TAttachMode AttachMode);
  176.     void __fastcall SetDisplayWidth(int Value);
  177.     __property Classes::TStrings* Lines = {read=GetStrings, write=SetStrings};
  178.     __property TOutlineStyle OutlineStyle = {read=FOutlineStyle, write=SetOutlineStyle, default=5};
  179.     __property EOutlineChange OnExpand = {read=FOnExpand, write=FOnExpand};
  180.     __property EOutlineChange OnCollapse = {read=FOnCollapse, write=FOnCollapse};
  181.     __property TOutlineOptions Options = {read=FOptions, write=SetOutlineOptions, default=3};
  182.     __property TOutlineType Style = {read=FStyle, write=SetStyle, default=0};
  183.     __property int ItemHeight = {read=FItemHeight, write=SetItemHeight, nodefault};
  184.     __property Stdctrls::TDrawItemEvent OnDrawItem = {read=FOnDrawItem, write=FOnDrawItem};
  185.     __property System::AnsiString ItemSeparator = {read=FSeparator, write=FSeparator};
  186.     __property Graphics::TBitmap* PicturePlus = {read=GetPicture, write=SetPicture, stored=StoreBitmap, 
  187.         index=0};
  188.     __property Graphics::TBitmap* PictureMinus = {read=GetPicture, write=SetPicture, stored=StoreBitmap
  189.         , index=1};
  190.     __property Graphics::TBitmap* PictureOpen = {read=GetPicture, write=SetPicture, stored=StoreBitmap, 
  191.         index=2};
  192.     __property Graphics::TBitmap* PictureClosed = {read=GetPicture, write=SetPicture, stored=StoreBitmap
  193.         , index=3};
  194.     __property Graphics::TBitmap* PictureLeaf = {read=GetPicture, write=SetPicture, stored=StoreBitmap, 
  195.         index=4};
  196.     
  197. public:
  198.     __fastcall virtual TCustomOutline(Classes::TComponent* AOwner);
  199.     __fastcall virtual ~TCustomOutline(void);
  200.     int __fastcall Add(int Index, const System::AnsiString Text);
  201.     int __fastcall AddChild(int Index, const System::AnsiString Text);
  202.     int __fastcall AddChildObject(int Index, const System::AnsiString Text, const void * Data);
  203.     int __fastcall AddObject(int Index, const System::AnsiString Text, const void * Data);
  204.     HIDESBASE int __fastcall Insert(int Index, const System::AnsiString Text);
  205.     int __fastcall InsertObject(int Index, const System::AnsiString Text, const void * Data);
  206.     void __fastcall Delete(int Index);
  207.     int __fastcall GetDataItem(void * Value);
  208.     int __fastcall GetItem(int X, int Y);
  209.     int __fastcall GetNodeDisplayWidth(TOutlineNode* Node);
  210.     int __fastcall GetTextItem(const System::AnsiString Value);
  211.     TOutlineNode* __fastcall GetVisibleNode(int Index);
  212.     void __fastcall FullExpand(void);
  213.     void __fastcall FullCollapse(void);
  214.     void __fastcall LoadFromFile(const System::AnsiString FileName);
  215.     void __fastcall LoadFromStream(Classes::TStream* Stream);
  216.     void __fastcall SaveToFile(const System::AnsiString FileName);
  217.     void __fastcall SaveToStream(Classes::TStream* Stream);
  218.     void __fastcall BeginUpdate(void);
  219.     void __fastcall EndUpdate(void);
  220.     void __fastcall SetUpdateState(bool Value);
  221.     void __fastcall Clear(void);
  222.     __property int ItemCount = {read=GetItemCount, nodefault};
  223.     __property TOutlineNode* Items[int Index] = {read=Get/*, default*/};
  224.     __property int SelectedItem = {read=GetSelectedItem, write=SetSelectedItem, nodefault};
  225.     __property Row ;
  226.     __property Canvas ;
  227. public:
  228.     /* TWinControl.CreateParented */ __fastcall TCustomOutline(HWND ParentWindow) : Grids::TCustomGrid(
  229.         ParentWindow) { }
  230.     
  231. };
  232.  
  233. class PASCALIMPLEMENTATION TOutlineNode : public Classes::TPersistent 
  234. {
  235.     typedef Classes::TPersistent inherited;
  236.     
  237. private:
  238.     Classes::TList* FList;
  239.     System::AnsiString FText;
  240.     void *FData;
  241.     TOutlineNode* FParent;
  242.     int FIndex;
  243.     bool FState;
  244.     TCustomOutline* FOutline;
  245.     int FExpandCount;
  246.     void __fastcall ChangeExpandedCount(int Value);
  247.     void __fastcall CloseNode(void);
  248.     void __fastcall Clear(void);
  249.     void __fastcall Error(const System::AnsiString ErrorString);
  250.     int __fastcall GetExpandedNodeCount(void);
  251.     System::AnsiString __fastcall GetFullPath(void);
  252.     int __fastcall GetIndex(void);
  253.     int __fastcall GetLastIndex(void);
  254.     Cardinal __fastcall GetLevel(void);
  255.     Classes::TList* __fastcall GetList(void);
  256.     Cardinal __fastcall GetMaxDisplayWidth(Cardinal Value);
  257.     TOutlineNode* __fastcall GetNode(int Index);
  258.     int __fastcall GetTopItem(void);
  259.     TOutlineNode* __fastcall GetVisibleParent(void);
  260.     bool __fastcall HasChildren(void);
  261.     bool __fastcall HasVisibleParent(void);
  262.     bool __fastcall IsEqual(TOutlineNode* Value);
  263.     void __fastcall ReIndex(TOutlineNode* StartNode, TOutlineNode* EndNode, int NewIndex, bool IncludeStart
  264.         );
  265.     void __fastcall Repaint(void);
  266.     bool __fastcall Resync(int &NewIndex, TOutlineNode* EndNode);
  267.     void __fastcall SetExpandedState(bool Value);
  268.     void __fastcall SetGoodIndex(void);
  269.     void __fastcall SetHorzScrollBar(void);
  270.     void __fastcall SetLevel(Cardinal Level);
  271.     void __fastcall SetText(const System::AnsiString Value);
  272.     
  273. protected:
  274.     __fastcall TOutlineNode(TCustomOutline* AOwner);
  275.     __fastcall virtual ~TOutlineNode(void);
  276.     TOutlineNode* __fastcall GetVisibleNode(int TargetCount);
  277.     int __fastcall AddNode(TOutlineNode* Value);
  278.     int __fastcall InsertNode(int Index, TOutlineNode* Value);
  279.     TOutlineNode* __fastcall GetNodeAtIndex(int TargetIndex);
  280.     int __fastcall GetDataItem(void * Value);
  281.     int __fastcall GetTextItem(const System::AnsiString Value);
  282.     bool __fastcall HasAsParent(TOutlineNode* Value);
  283.     bool __fastcall GetRowOfNode(TOutlineNode* TargetNode, int &RowCount);
  284.     void __fastcall InternalRemove(TOutlineNode* Value, int Index);
  285.     void __fastcall Remove(TOutlineNode* Value);
  286.     void __fastcall WriteNode(char * Buffer, Classes::TStream* Stream);
  287.     __property TCustomOutline* Outline = {read=FOutline};
  288.     __property Classes::TList* List = {read=GetList};
  289.     __property int ExpandCount = {read=FExpandCount, nodefault};
  290.     __property TOutlineNode* Items[int Index] = {read=GetNode/*, default*/};
  291.     
  292. public:
  293.     void __fastcall ChangeLevelBy(TChangeRange Value);
  294.     void __fastcall Collapse(void);
  295.     void __fastcall Expand(void);
  296.     void __fastcall FullExpand(void);
  297.     int __fastcall GetDisplayWidth(void);
  298.     int __fastcall getFirstChild(void);
  299.     int __fastcall GetLastChild(void);
  300.     int __fastcall GetNextChild(int Value);
  301.     int __fastcall GetPrevChild(int Value);
  302.     void __fastcall MoveTo(int Destination, TAttachMode AttachMode);
  303.     __property TOutlineNode* Parent = {read=FParent};
  304.     __property bool Expanded = {read=FState, write=SetExpandedState, nodefault};
  305.     __property System::AnsiString Text = {read=FText, write=SetText};
  306.     __property void * Data = {read=FData, write=FData};
  307.     __property int Index = {read=GetIndex, nodefault};
  308.     __property Cardinal Level = {read=GetLevel, write=SetLevel, nodefault};
  309.     __property bool HasItems = {read=HasChildren, nodefault};
  310.     __property bool IsVisible = {read=HasVisibleParent, nodefault};
  311.     __property int TopItem = {read=GetTopItem, nodefault};
  312.     __property System::AnsiString FullPath = {read=GetFullPath};
  313. };
  314.  
  315. typedef Shortint TBitmapArrayRange;
  316.  
  317. class DELPHICLASS TOutline;
  318. class PASCALIMPLEMENTATION TOutline : public Outline::TCustomOutline 
  319. {
  320.     typedef Outline::TCustomOutline inherited;
  321.     
  322. __published:
  323.     __property Lines ;
  324.     __property OutlineStyle ;
  325.     __property OnExpand ;
  326.     __property OnCollapse ;
  327.     __property Options ;
  328.     __property Style ;
  329.     __property ItemHeight ;
  330.     __property OnDrawItem ;
  331.     __property Align ;
  332.     __property Enabled ;
  333.     __property Font ;
  334.     __property Color ;
  335.     __property ParentColor ;
  336.     __property ParentCtl3D ;
  337.     __property Ctl3D ;
  338.     __property TabOrder ;
  339.     __property TabStop ;
  340.     __property Visible ;
  341.     __property OnClick ;
  342.     __property DragMode ;
  343.     __property DragCursor ;
  344.     __property OnDragDrop ;
  345.     __property OnDragOver ;
  346.     __property OnEndDrag ;
  347.     __property OnStartDrag ;
  348.     __property OnEnter ;
  349.     __property OnExit ;
  350.     __property OnMouseDown ;
  351.     __property OnMouseMove ;
  352.     __property OnMouseUp ;
  353.     __property OnDblClick ;
  354.     __property OnKeyDown ;
  355.     __property OnKeyPress ;
  356.     __property OnKeyUp ;
  357.     __property BorderStyle ;
  358.     __property ItemSeparator ;
  359.     __property PicturePlus ;
  360.     __property PictureMinus ;
  361.     __property PictureOpen ;
  362.     __property PictureClosed ;
  363.     __property PictureLeaf ;
  364.     __property ParentFont ;
  365.     __property ParentShowHint ;
  366.     __property ShowHint ;
  367.     __property PopupMenu ;
  368.     __property ScrollBars ;
  369. public:
  370.     /* TCustomOutline.Create */ __fastcall virtual TOutline(Classes::TComponent* AOwner) : Outline::TCustomOutline(
  371.         AOwner) { }
  372.     /* TCustomOutline.Destroy */ __fastcall virtual ~TOutline(void) { }
  373.     
  374. public:
  375.     /* TWinControl.CreateParented */ __fastcall TOutline(HWND ParentWindow) : Outline::TCustomOutline(ParentWindow
  376.         ) { }
  377.     
  378. };
  379.  
  380. //-- var, const, procedure ---------------------------------------------------
  381.  
  382. }    /* namespace Outline */
  383. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  384. using namespace Outline;
  385. #endif
  386. //-- end unit ----------------------------------------------------------------
  387. #endif    // Outline
  388.